<script type="text/javascript">
$(function() {
  var lat = '<?php echo $place['Place']['lat'];?>';
  var lng = '<?php echo $place['Place']['lng'];?>';
  var marker, ll, map;

  function loadMap() {
    if (lat && lng) {
      ll = new google.maps.LatLng(lat, lng);
    } else {
      ll = new google.maps.LatLng(-34.397, 150.644);
    }
    var opt = {
      zoom: 8,
      center: ll,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    var el = $("#map-container");
        map = new google.maps.Map(document.getElementById("map-container"), opt);

    if (lat && lng) {
      placeMarker(ll);
    }
  }

  function placeMarker(location) {
    marker = new google.maps.Marker({
      position: location,
      map: map,
      animation: google.maps.Animation.DROP
    });
    map.setCenter(location);
  }
  loadMap();
});
</script>
